import * as TYPES from "@/constants/index";

const state = {
  openId: "",
  unionId: "",
  commonToken: "", // 注意跟userToken的区别
};

const mutations = {
  CHANGE_COMMON_TOKEN: (state, { key, value }) => {
    if (state.hasOwnProperty(key)) {
      state[key] = value;
    }
  },
  [TYPES.UPDATE_APP_STATE]: (state, { key, value }) => {
    if (state.hasOwnProperty(key)) {
      state[key] = value;
    }
  },
};

const actions = {
  changeCommonToken: ({ commit }, payload) => {
    commit("CHANGE_COMMON_TOKEN", payload);
  },
  
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
